Skip to content

Ol10 edition baseline#6829

Draft
meyerlor wants to merge 2 commits into
3liz:masterfrom
meyerlor:ol10-edition-baseline
Draft

Ol10 edition baseline#6829
meyerlor wants to merge 2 commits into
3liz:masterfrom
meyerlor:ol10-edition-baseline

Conversation

@meyerlor
Copy link
Copy Markdown
Collaborator

Migrate edition Draw/Modify/Select from OL2 to OL10

  • Replace OpenLayers.Control.DrawFeature / ModifyFeature / SelectFeature
    with OL10 Draw, Modify and Select interactions. The OL2 vector edit
    layer becomes an OL10 VectorLayer / VectorSource on mainLizmap.map.
  • Auto-activate Modify after a feature is drawn, including for point
    layers. Feature highlights use the OL10 draw layer.
  • Route WMS extent / size queries through the OL10 view. Required
    because the OL10 map is now the source of truth for the visible
    viewport during edition.
  • New modules/Edition.js owns the WKT bridge between the digitizing
    module and the hidden geometry form field, and emits user-facing
    toasts. Duplicate toast dispatches removed from legacy/edition.js.
  • For point edition the digitizing toolbar is hidden; drawing begins
    automatically on click.
  • New baseline locale keys: edition.toolbar.redraw plus four
    digitizing.toolbar..help keys (edit / split / rotate / scaling).
  • Remove ~120 lines of dead OL2 split helpers from legacy/edition.js
    (afterReshapeSpliting, beforeFeatureSpliting, afterFeatureSpliting and
    their editCtrls.reshape / editCtrls.featsplit entries).

Builds on the snapping migration. The new digitizing module calls
mainLizmap.snapping.reorderSnapInteraction() after adding interactions,
so the OL10 Snap follows each new Draw / Modify / Translate.

Tests:

  • editing-geometry.spec.js, editing-value-relation.spec.js,
    edition-form.spec.js, form_advanced.spec.js, form_edition.spec.js,
    form_edition_value_relation_field.spec.js, dnd-form.spec.js,
    print.spec.js, singleWMS.spec.js: switch edition map interactions
    from clickOnMapLegacy / mapOl2 / #map to clickOnMap / map / #newOlMap,
    adjust coordinates for the OL10 safe zone, and add waitForFunction
    guards so tests wait for the OL10 Select / Modify interaction to be
    ready before dragTo.

Deferred to follow-up PRs: reshape, parallel offset, move (in edition),
distance/angle drawing constraints, split-with-server-save (the
digitizing-split button is therefore hidden in edition context for now,
remains available in draw context), ReverseGeom port, draw.spec.js
new-tool tests and pages/drawpage.js new-tool locators.

* Replace OpenLayers.Control.Snapping with the OL10 Snap interaction.
* Render snap features as a solid orange overlay while snapping is active.
* Drop the manual refresh button: getSnappingData() now runs automatically
  on moveend and on layer-tree visibility changes (the
  snapLayersRefreshable state and snapping.refreshable event are gone,
  no consumers remained).
* OL10 Snap exposes a single vertex flag and a single pixelTolerance, so
  snap_vertices is OR-ed with snap_intersections and pixelTolerance is
  max(snap_vertices_tolerance, snap_segments_tolerance). Worth flagging
  for projects that configure vertex vs intersection independently.
* Public reorderSnapInteraction() lets future callers re-add the Snap
  interaction so OL processes it before any recently-added Draw / Modify
  / Translate. No-op when snap is inactive.

Tests:
* snap.spec.js: remove three WFS 1.1.0 / SRSNAME / datum-shift tests that
  exercised the OL2 snap WFS path (replaced by OL10 GeoJSON parsing).
  Strip refresh-button click / disabled-state assertions from the snap
  panel test now that refresh is automatic.

This PR ships the snap infrastructure but does not visibly engage with
the OL2 edition Draw / Modify yet. Snapping starts to actually snap once
the follow-up OL10 edition migration lands.
@github-actions github-actions Bot added this to the 3.11.0 milestone May 14, 2026
@meyerlor meyerlor force-pushed the ol10-edition-baseline branch 3 times, most recently from 2817f9c to edcda01 Compare May 15, 2026 05:53
@meyerlor meyerlor force-pushed the ol10-edition-baseline branch 4 times, most recently from 397a29b to c0bbf8c Compare May 15, 2026 08:09
* Replace OpenLayers.Control.DrawFeature / ModifyFeature / SelectFeature
  with OL10 Draw, Modify and Select interactions. The OL2 vector edit
  layer becomes an OL10 VectorLayer / VectorSource on mainLizmap.map.
* Auto-activate Modify after a feature is drawn, including for point
  layers. Feature highlights use the OL10 draw layer.
* Route WMS extent / size queries through the OL10 view. Required
  because the OL10 map is now the source of truth for the visible
  viewport during edition.
* New modules/Edition.js owns the WKT bridge between the digitizing
  module and the hidden geometry form field, and emits user-facing
  toasts via #lizmap-editing-message (the legacy #lizmap-edition-message
  is still used for save-success / error toasts).
* Duplicate toast dispatches removed from legacy/edition.js so the
  "Edit vertices" / "Draw on the map" toast no longer appears twice.
* For point edition the digitizing toolbar is hidden; drawing begins
  automatically on click.
* New baseline locale keys: edition.toolbar.redraw plus four
  digitizing.toolbar.<tool>.help keys (edit / split / rotate / scaling).
* Remove ~120 lines of dead OL2 split helpers from legacy/edition.js
  (afterReshapeSpliting, beforeFeatureSpliting, afterFeatureSpliting and
  their editCtrls.reshape / editCtrls.featsplit entries).

Builds on the snapping migration. The new digitizing module calls
mainLizmap.snapping.reorderSnapInteraction() after adding interactions,
so the OL10 Snap follows each new Draw / Modify / Translate.

Tests:
* 9 spec files updated for OL10 map / interactions (clickOnMapLegacy
  → clickOnMap, mapOl2 → map, #map → #newOlMap, waitForFunction guards
  for Select/Modify).
* edition-form.spec.js: "must allow modification without creation"
  now expects #lizmap-editing-message (the new id) for the on-form
  edit-vertices toast.
* editing-copy-paste-geometry.spec.js: mark the 11 interaction tests
  test.fixme(). They cover behaviour that needs the OL10 GeometryCopy
  port (lands in the follow-up Copy/Paste PR).
* draw.spec.js: mark "Length and angle constraints" test.fixme() —
  the distance/angle constraint feature is deferred to a follow-up PR.

Deferred to follow-up PRs: reshape, parallel offset, move (in edition),
distance/angle drawing constraints, split-with-server-save (the
digitizing-split button is therefore hidden in edition context for now,
remains available in draw context), ReverseGeom port, draw.spec.js
new-tool tests and pages/drawpage.js new-tool locators.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

draw Drawing tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant